/*
 * @Author: your name
 * @Date: 2020-07-23 23:40:03
 * @LastEditTime: 2020-07-24 23:32:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \react_app\src\store\action_function.js
 */

  import {CHANGE_INPUT,ADD_TODO,INIT_TODO_LIST} from './actionType'
  import axios from 'axios'
  /**
   * 改变输入框中的值
   * @param {*} value
   */
  export const changtodeInputValue_action = (value)=>{
    return {
      type:CHANGE_INPUT,
      data :value
    }
  }

  /**
   * 添加todo
   * @param {*} value
   */
  export const addTodo_action = (value)=>{
    return {
      type:ADD_TODO,
      data :value
    }
  }
  /**初始化 */
  export const initTodoList_action = (dataList)=>{
    return {
      type:INIT_TODO_LIST,
      data :dataList
    }
  }

  export const getTodoList_action_fn = ()=>{
    return (dispatch)=>{
      axios.get('').then(res=>{
        console.log(res)
        const action = initTodoList_action(['请求来的8点公司开晨会分配今天的任务，总结昨天',
        '9点开项目需求会议',
        '10点修复昨天的bug问题',
        '11点做些开发工作预热'])
         dispatch(action)
      })
    }
  }
